HTTPCLIENT-1165: Add optional request collapsing for async cache misses#781
HTTPCLIENT-1165: Add optional request collapsing for async cache misses#781arturobernalg wants to merge 2 commits into
Conversation
|
@arturobernalg There is a lot of complexity in this change-set for what I personally see is little practical gain. Question. How well is this tested? How sure you are this is going to work reliably? |
da4c540 to
159d14c
Compare
@ok2c |
f52c8f4 to
8f850fc
Compare
Coalesce concurrent cacheable async requests for the same cache key so that only one backend request is executed on a cold miss. Waiting requests re-check the cache after the leader completes. Request collapsing is disabled by default and scoped to each caching executor.
eaa814d to
c595293
Compare
| /** | ||
| * Demonstrates optional request collapsing for concurrent async cache misses. | ||
| */ | ||
| public class AsyncClientCacheRequestCollapsing { |
There was a problem hiding this comment.
@arturobernalg Your examples tend to look like integration tests. This is not the point of examples. They need to demonstrate the use of APIs abd be informative. Please drop the server side code and just focus on the client APIs.
This change adds an optional request collapsing mechanism to the async caching executor to prevent multiple concurrent requests from fetching the same cacheable resource on a cold miss. When enabled, a single leader request is allowed to proceed to the backend while followers wait and then re-check the cache once the leader completes. The feature is disabled by default and is covered by unit tests for the collapser and an integration-style test validating that backend requests are reduced to one under concurrency.